# 列表中使用lambda
# result = [x ** 2 for x in range(10)]
# print(result)
#
# def multiple(x):
#     return x**2
# 方法1
# print([multiple(x) for x in range(10)])

# 方法2
# print([(lambda x:x**2)(x) for x in range(10)])

# 结合sort()函数, list.sort(key=None, reverse=False)
list_value = [32,13,64,5,88]
list_value.sort(reverse=True)
print(list_value)

# def take_second(list_val):
#     return list_val[1]

list_value2 = [(5,6),(7,3),(1,8)]
# list_value2.sort(key=take_second)
list_value2.sort(key=lambda x:x[1],reverse=True)
print(list_value2)
